import { lazy } from "react";

import LazyLoad from "./LazyLoad";

import { Navigate } from "react-router-dom";

const Home = lazy(() => import("../pages/home/Index"));
const Login = lazy(() => import("../pages/login/Index"));
const NotFound = lazy(() => import("../pages/notFound/Index"));

const Pro = lazy(() => import("../pages/home/pro/Index"));

const routes: any = [
  {
    path: "/",
    element: <Navigate to="/home"></Navigate>,
  },
  {
    path: "/home",
    element: <LazyLoad comp={<Home />}></LazyLoad>,
    children: [
      {
        path: "/home/pro",
        element: <LazyLoad comp={<Pro />}></LazyLoad>,
      },
    ],
  },
  {
    path: "/login",
    element: <LazyLoad comp={<Login />}></LazyLoad>,
  },
  {
    path: "*",
    element: <LazyLoad comp={<NotFound />}></LazyLoad>,
  },
];

export default routes;
